package com.xsd.iterator;

import java.util.Iterator;

/**
 * @Description: 计算机学院
 * @Author: zhoufuzong
 * @Created: 2021-03-06 19:45:16
 * @Version: 1.1.0
 */

public class ComputerCollege implements College {
    Department[] departments;

    // 保存当前数组的对象个数
    int numOfDepartment=0;

    public ComputerCollege() {
        departments =new Department[5];
        addDepartment("Java专业","java");
        addDepartment("PHP专业","php");
        addDepartment("大数据专业","大数据");
    }

    @Override
    public String getName() {
        return "计算机学院";
    }

    @Override
    public void addDepartment(String name, String desc) {
        Department department = new Department(name,desc);
        departments[numOfDepartment] = department;
        numOfDepartment +=1;
    }

    @Override
    public Iterator createIterator() {
        return new ComputerCollegeIterator(departments);
    }
}
